<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>睿云 让生活更美好！</title>
    <script src="../static/js/vue.js" th:src="@{/js/vue.js}"></script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../static/css/element.css" th:href="@{/css/element.css}">
    <link rel="stylesheet" href="../static/css/global.css" th:href="@{/css/global.css}"/>
    <link rel="stylesheet" href="../static/css/main.css" th:href="@{/css/main.css}"/>
    <link rel="stylesheet" href="../static/css/myelement.css" th:href="@{/css/myelement.css}"/>
    <!-- 引入组件库 -->
    <script src="../static/js/element.js" th:src="@{/js/element.js}"></script>
    <script type="text/javascript">
	    if (window != top) {
	    	 top.location.href = location.href; 
	       }
    </script>
</head>
<body>
<div id="app">
    <div class="store-login" :model="ruleForm2" :rules="rules2" ref="ruleForm2">
        <div class="login-box">
            <h1 class="login_logo"><img src="../static/img/store/logo2.png" th:src="@{/img/store/logo2.png}"></h1>
            <div class="store-login-form">
                <div class="form-item vendor">
                        <input type="text" v-model="ruleForm2.vendorName" placeholder="请输入所属商户名称" class="form_control">
                </div>
                <div class="form-item user">
                        <input type="text" v-model="ruleForm2.account" placeholder="请输入账号/手机号" class="form_control">
                </div>
                <div class="form-item password">
                        <input type="password" v-model="ruleForm2.checkPass" placeholder="请输入密码" class="form_control">
                </div>
                <div class="form-item yzm">
                   <input type="text" v-model="ruleForm2.checkCode" placeholder="请输入验证码" @keyup.enter="handleSubmit2" class="form_control">
                   <a class="yzm-img" href="##"><img th:src="@{/getVerify}" onclick="javascript:this.src='/getVerify?tm='+Math.random()"></a>
                </div>
                <div class="store-remind" >
		  	  	 		<div class="store-error fl" v-show="logining">{{rules2.message}}</div>
		  	  	 		<!-- <a class="fr" href="##">忘记密码?</a> -->
		  	  	 		<label class="store-prompt fr" v-bind:class="{ 'active': checked }">
		  	  	 			<input type="checkbox" v-model="checked">
							<s></s>记住我
					    </label>
		  	  	 	</div>
                <div class="store-btn">
                    <a href="javascript:void(0);" @click="handleSubmit2" :loading="logining">登录</a>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>

<script>
    new Vue({
        el: "#app",
        data: {
            logining: false,
            ruleForm2: {
                account: '',
                checkPass: '',
                vendorName: '',
                checkCode: ''
            },
            rules2: {
                message: '请输入账号',
            },
            checked: true
        },
        methods: {
            handleSubmit2: function (ev) {
                var _this = this;
                if (this.ruleForm2.vendorName == "") {
                    this.logining = true;
                    this.rules2.message = "商户名称不能为空";
                } else if (this.ruleForm2.account == "") {
                    this.logining = true;
                    this.rules2.message = "用户名不能为空";
                } else if (this.ruleForm2.checkPass == "") {
                    this.logining = true;
                    this.rules2.message = "密码不能为空";
                } else if (this.ruleForm2.checkCode == "") {
                    this.logining = true;
                    this.rules2.message = "验证码不能为空";
                } else {
                    $.post(
                        "[[@{/login}]]",
                        {username: this.ruleForm2.account, password: this.ruleForm2.checkPass,vendorName: this.ruleForm2.vendorName, checkCode: this.ruleForm2.checkCode},
                        function (data) {
                            if (data.returnCode == "1") {
                                window.location.href = "/";
                            } else if (data.returnCode == "2") {
                                _this.logining = true;
                                _this.rules2.message = data.returnNote;
                            }
                        }
                    );
                }
            }
        }
    });
</script>
</html>
